<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<f:view>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
	<html>
	<head>
	<title>IAP cursos</title>
	<link rel="stylesheet" href="../css/template.css" type="text/css">
	<script type="text/javascript" src="../scripts/jquery-1.2.3.js"></script>
	<script>


		$(document).ready(function(){
		 $("dd:not(:first)").hide();
		 $("dt a").click(function(){
		  $("dd:visible").slideUp("slow");
		  $(this).parent().next().slideDown("slow");
		  return false;
		 });
		});
	</script>
	</head>
	<body>
	<h:outputText value="#{controleHorarios.dado}"/>
	<div id="bg-top">
		<div id="dados_usuarios">
			<h:form>
				<h:commandLink action="#{logOutPageBean.sair}" value="Sair"/>
			</h:form>
		</div>
		<div id="top">
			<div id="logo-banner-admin">
				<div id="logo"></div>
				<div id="banner"></div>
			</div>
		</div>
	</div>
	<div id="bg-main">
		<div id="menu-horiz-top">
			<c:import url="components/menu-top.jsp"></c:import>
		</div>
		<div id="main">
			<div id="inner-main">
				<div id="menu-horario">
					<dl>
						<c:forEach var="unidade" items="#{controleHorarios.unidades}">
							<dt><a href="#"> <h:outputText value="#{unidade.nome}"></h:outputText></a>
							</dt>
							<dd><c:forEach var="turma" items="#{unidade.turmas}">
								<br>
								<a4j:form id="link_menu" ajaxSubmit="true" reRender="content">
									<a4j:commandLink styleClass="sublink" value="#{turma.nome}"
										action="#{controleHorarios.selecionarTurma}">
										<f:param name="id" value="#{turma.id}"></f:param>
									</a4j:commandLink>
								</a4j:form>
							</c:forEach></dd>
						</c:forEach>
					</dl>
				</div>

				<div class="conteudo">
				<h:messages />
					<rich:panel	id="content" styleClass="noborder">
						<rich:dataTable headerClass="head_tabela" border="0"
							rowClasses="linha1,linha2" var="horario" id="tabela_horarios"
							value="#{controleHorarios.turmaSelecionada.horarios}"
							rendered="#{controleHorarios.turmaSelecionada != null}">
							<rich:column  >
								<f:facet name="header">
									<h:outputText value="Horário" />
								</f:facet>
								<h:outputText value="#{horario}" />
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Domingo"/>
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Segunda" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>

							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Terca" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Quarta" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Quinta" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Sexta" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Sabado" />
								</f:facet>
								<h:outputLabel value="#{horario.aula.disciplina}" onclick="alerta();"/>
							</rich:column>

						</rich:dataTable>

						<a4j:form>
							<a4j:commandLink value="Editar" action="#{controleAtualizarHorarios.editarHorario}">
								<f:param value="#{controleHorarios.turmaSelecionada.id}" name="idTurma"></f:param>
							</a4j:commandLink>
						</a4j:form>
						<rich:dataTable var="aula" rowClasses="linha1,linha2"
							styleClass="tabela_disciplinas" headerClass="head_tabela_disciplinas"
							border="0" value="#{controleHorarios.aulas}">
							<rich:column>
								<f:facet name="header">
									<h:outputText value="Disciplina" />
								</f:facet>
								<h:outputText value="#{aula.disciplina}" />
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Professor" />
								</f:facet>
								<h:outputText value="#{aula.professor.nome}" />
							</rich:column>

							<rich:column>
								<f:facet name="header">
									<h:outputText value="Local" />
								</f:facet>
								<h:outputText value="#{aula.ambiente.nome}" />
							</rich:column>
						</rich:dataTable>
					</rich:panel>
				</div>
			</div>
		</div>
		<div id="bottom-div-main">

		</div>
	</div>
	<div id="bottom">

	</div>
	</body>
	</html>
</f:view>

